package mysql

import "gorm.io/gorm"

type ReceiveCoupons struct {
	gorm.Model
	CouponStatus        int     `gorm:"type:int(20);not null;comment:'1:满减券 2:商家优惠券 3:平台优惠券'"`
	CouponFullPrice     float64 `gorm:"type:double(10,2);not null;comment:'需要满多少元才能使用（只针对满减券）'"`
	CouponDisCountPrice float64 `gorm:"type:double(10,2);not null;comment:'可减多少元'"`
	CouponType          int     `gorm:"type:int(20);not null;comment:'1:已领取 2:未领取'"`
	CouponsSn           string  `gorm:"type:varchar(100);not null;comment:'优惠券号'"`
}

func GetCouponList() (coupons []*ReceiveCoupons, err2 error) {
	DB.Debug().Find(&coupons)
	return
}
func CouponsShow(id int) (result *ReceiveCoupons, err2 error) {
	DB.Debug().Where("id = ?", id).Limit(1).Find(&result)
	return
}
